package com.yunhe.authority.domain.authority;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yunhe.authority.domain.base.Area;
import com.yunhe.authority.domain.base.FirmType;
import com.yunhe.common.annotation.EnumItemCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.neo4j.ogm.annotation.*;

import java.io.Serializable;
import java.util.List;

/**
 * 单位对象
 * @desc 单位对象定义
 * @author liuronglei
 */
@ApiModel(value = "Firm", description = "单位对象")
@NodeEntity
public class Firm implements Comparable<Firm>, Serializable {
    @ApiModelProperty(value = "单位ID")
    @Id
    @GeneratedValue
    private Long id;
    @ApiModelProperty(value = "单位编号",required = false)
    private String name;
    @JsonIgnore
    @ApiModelProperty(value = "单位代码", hidden = true)
    private Long code;
    @JsonIgnore
    @ApiModelProperty(value = "标题", hidden = true)
    private String title;
//    @JsonIgnore
//    @ApiModelProperty(value = "系统标题", hidden = true)
//    private String systemTitle;
    @JsonIgnore
    @ApiModelProperty(value = "通信代码", hidden = true)
    private String communicationCode;
    @JsonIgnore
    @ApiModelProperty(value = "子单位", hidden = true)
    @Relationship(type = "HAS_CHILD")
    private List<Firm> children;
    @JsonIgnore
    @ApiModelProperty(value = "是否是根节点", hidden = true)
    private Boolean root = false;
    @ApiModelProperty(value = "是否可用", hidden = true)
    private String activity = "1";
    @ApiModelProperty(value = "排序序号", hidden = true)
    private String sn;
    @JsonIgnore
    @ApiModelProperty(value = "所属地区", hidden = true)
    @Relationship(type = "AREA_OF")
    private Area area;
    @JsonIgnore
    @ApiModelProperty(value = "所属单位类型", hidden = true)
    @Relationship(type = "FIRMTYPE_OF")
    private FirmType firmType;
    @JsonIgnore
    @Relationship(type = "HOMEPAGE_OF")
    private HomePage homePage;
    @JsonIgnore
    @ApiModelProperty(value = "经纬度", hidden = true)
    private String logAndLat;
    @ApiModelProperty(value = "拥有的电站")
    @Relationship(type = "HAS_STATION")
    private List<Station> stations;

    @ApiModelProperty(value = "园区静态数据", hidden = true)
    @JsonIgnore
    @Relationship(type = "FirmStaticData_OF")
    private FirmStaticData firmStaticData;

    @ApiModelProperty(value = "系统平台")
    @Property(name = "system")
    private  String system;

    @ApiModelProperty(value = "系统平台")
    @EnumItemCode(code = "system",fieldTitle = "system")
    private  String systemTitle;
    @ApiModelProperty(value = "企业全称")
    @Property(name = "enterpriseFullName")
    private String enterpriseFullName;
    @ApiModelProperty(value = "曾用名")
    @Property(name = "formerName")
    private String formerName;
    @ApiModelProperty(value = "项目区域地址")
    @Property(name = "areaAddress")
    private String areaAddress;

    @ApiModelProperty(value = "项目区域地址Title")
    @EnumItemCode(code = "Area",fieldTitle = "areaAddress")
    private String areaAddressTitle;
    @ApiModelProperty(value = "项目详细地址")
    @Property(name = "address")
    private String address;
    @ApiModelProperty(value = "行业分类")
    @Property(name = "category")
    private String category;

    @ApiModelProperty(value = "行业分类Title")
    @EnumItemCode(code = "industryCategory",fieldTitle = "category")
    private  String categoryTitle;
    @ApiModelProperty(value = "企业logo原图")
    @Property(name = "corporateLogo")
    private String corporateLogo;
    @ApiModelProperty(value = "企业logo缩略图")
    @Property(name = "corporateLogoThumbnail")
    private String corporateLogoThumbnail;
    @ApiModelProperty(value = "统一社会信用代码")
    @Property(name = "unifiedSocialCreditCode")
    private String unifiedSocialCreditCode;
    @ApiModelProperty(value = "企业法人名称")
    @Property(name = "corporateName")
    private String corporateName;
    @ApiModelProperty(value = "企业注册地址")
    @Property(name = "businessRegisteredAddress")
    private String businessRegisteredAddress;
    @ApiModelProperty(value = "注册资本")
    @Property(name = "registeredCapital")
    private String registeredCapital;
    @ApiModelProperty(value = "营业期限")
    @Property(name = "operatingPeriod")
    private String operatingPeriod;
    @ApiModelProperty(value = "联系人")
    @Property(name = "contactPerson")
    private String contactPerson;
    @ApiModelProperty(value = "联系方式")
    @Property(name = "phone")
    private String phone;
    @ApiModelProperty(value = "联系人职务")
    @Property(name = "contactTitle")
    private String contactTitle;
    @ApiModelProperty(value = "创建时间")
    @Property(name = "createTime")
    private String createTime;

    @Override
    public int compareTo(Firm o) {
        if (this.sn == null) {
            return -1;
        } else if (o.getSn() == null) {
            return 1;
        }
        return this.sn.compareTo(o.getSn());
    }

    public String getLogAndLat() {
        return logAndLat;
    }

    public void setLogAndLat(String logAndLat) {
        this.logAndLat = logAndLat;
    }

    public HomePage getHomePage() {
        return homePage;
    }

    public void setHomePage(HomePage homePage) {
        this.homePage = homePage;
    }

    public String getCommunicationCode() {
        return communicationCode;
    }

    public void setCommunicationCode(String communicationCode) {
        this.communicationCode = communicationCode;
    }

    public Long getCode() {
        return code;
    }

    public void setCode(Long code) {
        this.code = code;
    }

    public String getSystemTitle() {
        return systemTitle;
    }

    public void setSystemTitle(String systemTitle) {
        this.systemTitle = systemTitle;
    }

    public Boolean getRoot() {
        return root;
    }

    public void setRoot(Boolean root) {
        this.root = root;
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public List<Firm> getChildren() {
        return children;
    }

    public void setChildren(List<Firm> children) {
        this.children = children;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getActivity() {
        return activity;
    }

    public void setActivity(String activity) {
        this.activity = activity;
    }

    public Area getArea() {
        return area;
    }

    public void setArea(Area area) {
        this.area = area;
    }

    public FirmType getFirmType() {
        return firmType;
    }

    public void setFirmType(FirmType firmType) {
        this.firmType = firmType;
    }

    public List<Station> getStations() {
        return stations;
    }

    public void setStations(List<Station> stations) {
        this.stations = stations;
    }

    public FirmStaticData getFirmStaticData() {
        return firmStaticData;
    }

    public void setFirmStaticData(FirmStaticData firmStaticData) {
        this.firmStaticData = firmStaticData;
    }

    public String getSystem() {
        return system;
    }

    public void setSystem(String system) {
        this.system = system;
    }

    public String getEnterpriseFullName() {
        return enterpriseFullName;
    }

    public void setEnterpriseFullName(String enterpriseFullName) {
        this.enterpriseFullName = enterpriseFullName;
    }

    public String getFormerName() {
        return formerName;
    }

    public void setFormerName(String formerName) {
        this.formerName = formerName;
    }

    public String getAreaAddress() {
        return areaAddress;
    }

    public void setAreaAddress(String areaAddress) {
        this.areaAddress = areaAddress;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getCorporateLogo() {
        return corporateLogo;
    }

    public void setCorporateLogo(String corporateLogo) {
        this.corporateLogo = corporateLogo;
    }

    public String getCorporateLogoThumbnail() {
        return corporateLogoThumbnail;
    }

    public void setCorporateLogoThumbnail(String corporateLogoThumbnail) {
        this.corporateLogoThumbnail = corporateLogoThumbnail;
    }

    public String getUnifiedSocialCreditCode() {
        return unifiedSocialCreditCode;
    }

    public void setUnifiedSocialCreditCode(String unifiedSocialCreditCode) {
        this.unifiedSocialCreditCode = unifiedSocialCreditCode;
    }

    public String getCorporateName() {
        return corporateName;
    }

    public void setCorporateName(String corporateName) {
        this.corporateName = corporateName;
    }

    public String getBusinessRegisteredAddress() {
        return businessRegisteredAddress;
    }

    public void setBusinessRegisteredAddress(String businessRegisteredAddress) {
        this.businessRegisteredAddress = businessRegisteredAddress;
    }

    public String getRegisteredCapital() {
        return registeredCapital;
    }

    public void setRegisteredCapital(String registeredCapital) {
        this.registeredCapital = registeredCapital;
    }

    public String getOperatingPeriod() {
        return operatingPeriod;
    }

    public void setOperatingPeriod(String operatingPeriod) {
        this.operatingPeriod = operatingPeriod;
    }

    public String getContactPerson() {
        return contactPerson;
    }

    public void setContactPerson(String contactPerson) {
        this.contactPerson = contactPerson;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getContactTitle() {
        return contactTitle;
    }

    public void setContactTitle(String contactTitle) {
        this.contactTitle = contactTitle;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getAreaAddressTitle() {
        return areaAddressTitle;
    }

    public void setAreaAddressTitle(String areaAddressTitle) {
        this.areaAddressTitle = areaAddressTitle;
    }

    public String getCategoryTitle() {
        return categoryTitle;
    }

    public void setCategoryTitle(String categoryTitle) {
        this.categoryTitle = categoryTitle;
    }
}
